From: Gert Wollny Date: Thu, 22 Jun 2017 07:54:59 +0000 (+0000) Subject: Add patch to fix rounding errors X-Git-Tag: archive/raspbian/3.6.9-4+rpi1^2~231 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=24d0a61e9197add4fe329f3a892bd3d7a2351537;p=dcmtk.git Add patch to fix rounding errors --- diff --git a/debian/patches/09_round_time.patch b/debian/patches/09_round_time.patch new file mode 100644 index 00000000..f4f3464e --- /dev/null +++ b/debian/patches/09_round_time.patch @@ -0,0 +1,18 @@ +Author: Gert Wollny +Description: work around numerical instability by rounding the time in seconds + to the six decimal points supported in dicom +Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859204 + +--- a/ofstd/libsrc/oftime.cc ++++ b/ofstd/libsrc/oftime.cc +@@ -491,6 +491,10 @@ + { + /* compute number of seconds since 00:00:00 */ + double result = ((OFstatic_cast(double, hour) - timeZone) * 60 + OFstatic_cast(double, minute)) * 60 + second; ++ ++ /* Dicom supports only six decimal digits, but floating point operations might introduce errors */ ++ result = round(result * 1000000.0) / 1000000.0; ++ + /* normalize the result to the range [0.0,86400.0[ */ + if (normalize) + result -= OFstatic_cast(double, OFstatic_cast(unsigned long, result / 86400) * 86400); diff --git a/debian/patches/series b/debian/patches/series index c7ae9103..0ae3d31b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ 06_soversion_abi.patch 07_dont_export_all_executables.patch 08_remove_system_processor.patch +09_round_time.patch